package com.sx.jys.app.net

import com.sx.jys.app.net.bean.AccountBean
import com.sx.jys.app.net.bean.ApiPageResponse
import com.sx.jys.app.net.bean.ApiResponse
import com.sx.jys.app.net.bean.CkNumBean
import com.sx.jys.app.net.bean.CoinBean
import com.sx.jys.app.net.bean.EmptyDataApiResponse
import com.sx.jys.app.net.bean.FxBeanList
import com.sx.jys.app.net.bean.HomeListBean
import com.sx.jys.app.net.bean.LoginBean
import com.sx.jys.app.net.bean.OrderBean
import com.sx.jys.app.net.bean.RespConfig
import com.sx.jys.app.net.bean.SwithcBean
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface ApiService {
    companion object {
//        var SERVER_URL = "http://47.242.201.114:6002/" //总监
//        var SERVER_URL = "http://8.218.203.153:6002/" //刘浪
        var SERVER_URL = "http://47.76.42.112:6002/" //..
//        var SERVER_URL = "http://192.168.1.36:6008/"
    }

    @GET("/api/data/login")
    suspend fun login(
        @Query("phone") phone: String,
        @Query("passWord") passWord: String
    ): ApiResponse<LoginBean>

    @GET("/api/data/home/get")
    suspend fun homeList(@Query("type") type: Int): ApiResponse<HomeListBean>

    /*持仓*/
    @GET("/api/data/order/list")
    suspend fun ckList(
        @Query("current") current: Int,
        @Query("status") status: String?
    ): ApiResponse<ApiPageResponse<OrderBean>>

    /**二级订单*/
    @GET("/api/data/order/secondaryList")
    suspend fun ckSecondList(
        @Query("code") code: String,
        @Query("current") current: Int,
        @Query("openTime") openTime: String?,
        @Query("status") status: String?
    ): ApiResponse<ApiPageResponse<OrderBean>>


    /**策略开关*/
    @GET("/api/data/base/orderSwitch")
    suspend fun orderSwitch(@Query("type") type: String): EmptyDataApiResponse

    /**策略查看*/
    @GET("/api/data/base/getSysInfo")
    suspend fun switchSelect(@Query("enu") enu: String): ApiResponse<SwithcBean>

    /**退出登录*/
    @POST("/api/data/outLogin")
    suspend fun logOut(): EmptyDataApiResponse

    @GET("/api/data/order/numbers")
    suspend fun ckNum(): ApiResponse<CkNumBean>

    @GET("/api/data/base/getAccount")
    suspend fun accountList(): ApiResponse<MutableList<AccountBean>>

    @GET("/api/data/curr/list")
    suspend fun currList(): ApiResponse<MutableList<FxBeanList>>

    @POST("/api/data/curr/set")
    suspend fun currSet(@Body bean: FxBeanList): EmptyDataApiResponse

    @GET("/api/data/curr/list")
    suspend fun coinList(): ApiResponse<MutableList<CoinBean>>

    @GET("/api/data/sysorder/recordingOrder")
    suspend fun recordingOrder(
        @Query("code") code: String,
        @Query("id") id: String,
        @Query("orderType") orderType: String,
        @Query("multiple") multiple: String,
        @Query("stopPrice") stopPrice: String,
        @Query("losePrice") losePrice: String,
        @Query("entrustedPrice") entrustedPrice: String
    ): EmptyDataApiResponse

    @GET("/api/data/order/closeAll")
    suspend fun closeAll(
        @Query("code") code: String?,
        @Query("openTime") openTime: String?,
        @Query("isOneOrder") isOneOrder: String?
    ): EmptyDataApiResponse

    @POST("/api/data/base/editSysInfo")
    suspend fun configSetting(@Body bean: RespConfig): EmptyDataApiResponse

    @GET("/api/data/base/marginLimit")
    suspend fun marginLimit(
        @Query("id") id: String,
        @Query("limit") limit: String
    ): EmptyDataApiResponse

    @GET("/api/data/base/adjustLever")
    suspend fun leverageAllLimit(@Query("leverage") leverage: String): EmptyDataApiResponse

    @GET("/api/data/sysorder/setProfitloss")
    suspend fun setProfitloss(
        @Query("code") code: String, @Query("openTime") openTime: String,
        @Query("stopPrice") stopPrice: String?, @Query("losePrice") losePrice: String?
    ):EmptyDataApiResponse

    @GET("/api/data/sysorder/revokeOrder")
    suspend fun orderBack( @Query("code") code: String, @Query("openTime") openTime: String):EmptyDataApiResponse
}